<template>
  <div>
    <el-container>
      <!-- 头部 -->
      <el-header style="height: 10vh">
        <el-button
          class="return"
          icon="el-icon-back"
          size="small"
          plain
          @click="toReturn()"
          >返回首页</el-button
        >
        艺术品交易网站后台管理
      </el-header>

      <div class="main" style="display: flex">
        <!-- 侧边栏 -->
        <div>
          <el-container>
            <el-aside
              width="250px"
              style="
                overflow: hidden;
                min-height: 90vh;
                background-color: #ffffff;
              "
            >
              <el-menu
                :default-active="$route.path"
                router
                style="overflow: auto; max-height: 74vh"
                class="el-menu-vertical-demo"
              >
                <el-menu-item index="/Visualization/index">
                  <i class="el-icon-s-platform"></i>
                  <span>数据大屏</span>
                </el-menu-item>

                <el-menu-item index="/admin/PersonnelManagement">
                  <i class="el-icon-user"></i>
                  <span>人员管理</span>
                </el-menu-item>

                <el-menu-item index="/admin/OrderManagement">
                  <i class="el-icon-user"></i>
                  <span>订单管理</span>
                </el-menu-item>

                <el-menu-item @click="signOut">
                  <i class="el-icon-back"></i>
                  <span slot="title">退出登录</span>
                </el-menu-item>
              </el-menu>
            </el-aside>
          </el-container>
        </div>

        <div class="right">
          <router-view />
        </div>
      </div>
    </el-container>
  </div>
</template>

<script>
import Cookies from "js-cookie";
import { mapActions, mapState } from "vuex";
export default {
  data() {
    return {
      data: {
        username: "",
        privilege_level: "",
      },
    };
  },
  computed: {
    ...mapState(["user"]),
  },
  created() {},
  methods: {
    ...mapActions(["resetState"]),

    toReturn() {
      this.$router.push("/");
    },

    signOut() {
      localStorage.removeItem("vuex");
      Cookies.remove("token");
      this.resetState();
      this.$router.push("/login");
    },
  },
};
</script>

<style lang="less" scoped>
.el-header {
  border: 1px solid #a4a4a4;
  text-align: center;
  line-height: 10vh;

  font-size: 24px;
  font-weight: bold;
  letter-spacing: 5px;
}
.el-aside {
  border: 1px solid #a4a4a4;
}
.icon {
  width: 50px;
}

.el-menu-vertical-demo::-webkit-scrollbar {
  display: none; //Chorme
}
.el-header {
  position: relative;
}
.return {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.right {
  width: calc(100% - 250px);
  height: 90vh;
  overflow: auto;
}
</style>
